<?php
class ModelSettingExtension extends Model {
	function getExtensions($type) {
		$restaurant_id = (int)$this->config->get('config_restaurant_id');
		
		$sql = "SELECT * FROM " . DB_PREFIX . "extension WHERE `type` = '" . $this->db->escape($type) . "'";
		
		// Because payment, shipping are configured manually by each restaurant then get only extenstions for current restaurant
		if($type == 'payment' || $type == 'shipping'){
			$sql .= " AND (restaurant_id = '" . $restaurant_id . "')";
		}else{
			$sql .= " AND (restaurant_id = '0' OR restaurant_id = '" . $restaurant_id . "')";
		}
		
		$query = $this->db->query($sql);

		return $query->rows;
	}
}
?>